package com.yy.wga.user.service.task;

import com.yy.wga.common.aop.DistributedLock;
import com.yy.wga.module.user.service.UserRelationSummaryService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @Author: gc
 * @Date: 2024/10/30
 * @Description:
 **/
@Slf4j
@RequiredArgsConstructor
@Component
public class UserRelationSummaryTask {
    private final UserRelationSummaryService userRelationSummaryService;

    /**
     * 每1小时汇总用户粉丝数据
     */
    @DistributedLock(value = "'userRelationSummaryTask'", waitTime = 1)
    @Scheduled(cron = "39 5 * * * ? ")
    public void summary() {
        log.info("开始汇总用户粉丝数据");
        userRelationSummaryService.summary();
        log.info("汇总用户粉丝数据完成");
    }
}
